{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "6dfc39a1-2951-4e32-858d-f1aaf3663708",
   "metadata": {},
   "source": [
    "# 一、Levenshtein 距离（编辑距离）\n",
    "* 描述：Levenshtein 距离衡量的是将一个字符串转换成另一个字符串所需的最少操作数（插入、删除、替换）。\n",
    "* 应用：当两个字符串有轻微拼写差异时（如“Vince S.”与“Vince Samuel”），Levenshtein 距离能很好地评估它们的相似度。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "741ef527-9fc3-4080-b8d8-5c6fdc5758e9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.8\n",
      "Levenshtein distance: 6\n",
      "Similarity score: 0.67\n"
     ]
    }
   ],
   "source": [
    "\n",
    "import Levenshtein\n",
    "\n",
    "def string_similarity(str1, str2):\n",
    "    distance = Levenshtein.distance(str1, str2)\n",
    "    similarity = 1 - (distance / max(len(str1), len(str2)))\n",
    "    return similarity\n",
    "\n",
    "str1 = \"jellyfish\"\n",
    "str2 = \"smellyfish\"\n",
    "similarity = string_similarity(str1, str2)\n",
    "print(similarity)\n",
    "\n",
    "import Levenshtein\n",
    "\n",
    "# 定义两个名字\n",
    "name1 = \"Vince, Samuel\".lower()\n",
    "name2 = \"Vince S.\".lower()\n",
    "\n",
    "# 计算 Levenshtein 距离（编辑距离）\n",
    "lev_distance = Levenshtein.distance(name1, name2)\n",
    "print(f\"Levenshtein distance: {lev_distance}\")\n",
    "\n",
    "# 计算相似度（0到1之间的值，1表示完全相同）\n",
    "similarity = Levenshtein.ratio(name1, name2)\n",
    "print(f\"Similarity score: {similarity:.2f}\")\n",
    "\n",
    "import jellyfish\n",
    "# 这些方法都是测量两个字符串之间的差异（又称编辑距离） \n",
    "# 编辑距离表示将一个单词更改为另一个单词所需的插入、删除和替换的次数\n",
    "lev_distance = jellyfish.levenshtein_distance('jellyfish', 'smellyfish')\n",
    "print(lev_distance)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3f267484-7cf5-47f8-8cc7-2b8cae714cb8",
   "metadata": {},
   "source": [
    "# 二、Jaro-Winkler 相似度\n",
    "* 描述：Jaro-Winkler 相似度衡量两个字符串的相似度，考虑了字符顺序，并对匹配位置较前的字符赋予更高的权重。特别适用于名字匹配。\n",
    "* 应用：适用于拼写相似但顺序不完全一致的名字匹配。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "d4555c0e-46e1-41ea-a545-b2198c655e2a",
   "metadata": {},
   "outputs": [],
   "source": [
    "ref_text=\"艾滋病诊疗指南a王爱霞王福祥毛青冯铁建卢洪洲孙洪清孙永涛叶寒辉李太生刘正印何云吴昊吴南屏张福杰张跃新周伯平周曾全郑煌煌赵红心赵燕赵敏赵清霞尚红娄国强桂希恩姚文虎唐小平徐莲芝徐小元黄绍标曹韵贞盛蕾康来仪斯崇文蒋岩蔡卫平樊庆泊潘孝彰中华医学会第五次全国艾滋病病毒性丙型肝炎暨全国热带病学术会议论文汇编c2011\"\n",
    "b=\"王爱霞王福祥毛青艾滋病诊疗指南a中华医学会第五次全国艾滋病病毒性丙型肝炎暨全国热带病学术会议论文汇编c2011\"\n",
    "a =\"王爱霞王福祥毛青艾滋病诊疗指南a中华医学会第五次全国艾滋病病毒性丙型肝炎暨全国热带病学术会议论文汇编c中华医学会第五次全国艾滋病病毒性丙型肝炎暨全国热带病学术会议2011\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "26deac42-c0c8-4d2e-9cb4-5acc6c1ee34b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.36350055173584583\n",
      "0.587462490237185\n"
     ]
    }
   ],
   "source": [
    "import jellyfish\n",
    "similarity = jellyfish.jaro_similarity(ref_text, b)\n",
    "print(similarity)\n",
    "similarity = jellyfish.jaro_similarity(ref_text, a)\n",
    "print(similarity)\n",
    "\n",
    "# Damerau-编辑距离\n",
    "# 计算 s1 和 s2 之间的 Damerau-Levenshtein 距离。\n",
    "# Damerau-Levenshtein 距离是 Levenshtein 距离的修改，它将换位（例如将 ifsh 表示为 fish）计为一次编辑。\n",
    "# 尽管这算作转置，levenshtein_distance('fish', 'ifsh') == 2但它需要删除和插入。damerau_levenshtein_distance('fish', 'ifsh') == 1\n",
    "jellyfish.jaro_similarity('潭江底栖动物多样性健康评价', '崇加荣凌去非等苏州地区6大湖泊底栖动物多样性的研究j水利渔业20012153335')\n",
    "jellyfish.damerau_levenshtein_distance('jellyfish', 'jellyfihs')\n",
    "jellyfish.jaro_winkler_similarity('jellyfish', 'jellyfihs')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "ad56ae65-e9fa-4cc3-b8b7-a4e7bb98757a",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[nltk_data] Downloading package punkt to\n",
      "[nltk_data]     C:\\Users\\Administrator\\AppData\\Roaming\\nltk_data...\n",
      "[nltk_data]   Unzipping tokenizers\\punkt.zip.\n",
      "D:\\anaconda3\\envs\\jupyterlabuse\\Lib\\site-packages\\sklearn\\feature_extraction\\text.py:521: UserWarning: The parameter 'token_pattern' will not be used since 'tokenizer' is not None'\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.0\n"
     ]
    }
   ],
   "source": [
    "from sklearn.feature_extraction.text import TfidfVectorizer\n",
    "from sklearn.metrics.pairwise import cosine_similarity\n",
    "import nltk\n",
    "\n",
    "nltk.download('punkt')\n",
    "\n",
    "def string_similarity(str1, str2):\n",
    "    corpus = [str1, str2]  # 将两个字符串组成语料库\n",
    "    vectorizer = TfidfVectorizer(tokenizer=nltk.word_tokenize)  # 使用TF-IDF向量化文本\n",
    "    tfidf_matrix = vectorizer.fit_transform(corpus)\n",
    "    similarity = cosine_similarity(tfidf_matrix[0:1], tfidf_matrix[1:2])\n",
    "    return similarity[0][0]\n",
    "\n",
    "str1 = \"hello\"\n",
    "str2 = \"helo\"\n",
    "similarity = string_similarity(str1, str2)\n",
    "print(similarity)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9d0233d7-f9cc-4e1e-9c7f-cb31f044c8b1",
   "metadata": {},
   "source": [
    "# Damerau-Levenshtein \n",
    "\n",
    "* 是一种常用于计算两个字符串之间相似度的算法，它是 Levenshtein距离（编辑距离）的扩展，允许插入、删除、替换字符以及交换相邻字符（转置操作）。这种扩展使得该算法比传统的 Levenshtein 距离更能容忍一些常见的拼写错误，尤其是字符交换错误（例如 \"acde\" 和 \"cade\"）。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "a79715b9-b1f5-4906-9c84-98ac7be6028a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(6, 0.42857142857142855, 8, 0.5714285714285714)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "from rapidfuzz.distance import DamerauLevenshtein\n",
    "a = DamerauLevenshtein.distance(\"Druitt, Robert\", \"Druitt R.\")\n",
    "# 计算如下。distance / max(len1, len2)\n",
    "b = DamerauLevenshtein.normalized_distance(\"Druitt, Robert\", \"Druitt R.\")\n",
    "# 计算如下。max(len1, len2) - distance\n",
    "c = DamerauLevenshtein.similarity(\"Druitt, Robert\", \"Druitt R.\")\n",
    "# 计算如下：1 - normalized_distance\n",
    "d = DamerauLevenshtein.normalized_similarity(\"Druitt, Robert\", \"Druitt R.\")\n",
    "a,b,c,d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "f8e375a1-1bcb-4573-8d12-09d63806cf1d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "8"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from rapidfuzz.distance import Hamming\n",
    "\n",
    "# 计算Hamming距离\n",
    "a = distance = Hamming.distance(\"Druitt, Robert\", \"Druitt R.\")\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "724bbbfd-3dee-4e19-8552-5aad482be6db",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from rapidfuzz.distance import Indel\n",
    "a  = Indel.distance(\"Druitt, Robert\", \"Druitt R.\")\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "45daa06d-6986-41ff-b596-6734fe4fe9cd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0.17989417989417988,\n",
       " 0.17989417989417988,\n",
       " 0.8201058201058201,\n",
       " 0.8201058201058201)"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "from rapidfuzz.distance import Jaro\n",
    "a  = Jaro.distance(\"Druitt, Robert\", \"Druitt R.\")\n",
    "b = Jaro.normalized_distance(\"Druitt, Robert\", \"Druitt R.\")\n",
    "c = Jaro.similarity(\"Druitt, Robert\", \"Druitt R.\")\n",
    "d = Jaro.normalized_similarity(\"Druitt, Robert\", \"Druitt R.\")\n",
    "a,b,c,d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "0fed00c7-a6fa-4d86-971e-a8d52f08289b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0.17989417989417988,\n",
       " 0.10793650793650789,\n",
       " 0.8920634920634921,\n",
       " 0.8920634920634921)"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from rapidfuzz.distance import JaroWinkler\n",
    "a  = Jaro.distance(\"Druitt, Robert\", \"Druitt R.\")\n",
    "b = JaroWinkler.normalized_distance(\"Druitt, Robert\", \"Druitt R.\")\n",
    "c = JaroWinkler.similarity(\"Druitt, Robert\", \"Druitt R.\")\n",
    "d = JaroWinkler.normalized_similarity(\"Druitt, Robert\", \"Druitt R.\")\n",
    "a,b,c,d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "c24b3404-0c33-4c66-bb9d-b5056681a19e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from rapidfuzz.distance import LCSseq\n",
    "a = LCSseq.distance(\"Druitt, Robert\", \"Druitt R.\")\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "03feb0bd-9cd0-4f2c-9596-3a9e05713fc5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from rapidfuzz.distance import OSA\n",
    "a = OSA.distance(\"Druitt, Robert\", \"Druitt R.\")\n",
    "a"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6a362ae3-54a7-4ce2-bb92-33ae8a3aeda3",
   "metadata": {},
   "source": [
    "## 使用 thefuzz\n",
    "\n",
    "该库是 fuzzywuzzy 的替换\n",
    "\n",
    "#### https://github.com/seatgeek/thefuzz\n",
    "\n",
    "更加推荐\n",
    "#### https://github.com/rapidfuzz/RapidFuzz "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "561a85a4-9f3c-4f90-a304-016e9f0806c8",
   "metadata": {},
   "outputs": [],
   "source": [
    "from thefuzz import fuzz\n",
    "from thefuzz import process"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "1c35954c-d3c1-431e-8d81-4d79ffdc9521",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "97"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 简单比率\n",
    "fuzz.ratio(\"this is a test\", \"this is a test!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "401292fe-bcf2-41b0-9990-e683d1742442",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "100"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 部分比率\n",
    "fuzz.partial_ratio(\"this is a test\", \"this is a test!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "2cff001b-f09e-495a-a06c-5fa2694e69e6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "91"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 令牌排序比率\n",
    "fuzz.ratio(\"fuzzy wuzzy was a bear\", \"wuzzy fuzzy was a bear\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "052d3266-1b1b-4e7c-830f-124e838f6c35",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "100"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fuzz.token_sort_ratio(\"fuzzy wuzzy was a bear\", \"wuzzy fuzzy was a bear\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "88fa52ae-5c4a-4c8a-bf35-fc6d174179c5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "84"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#代币设置比率\n",
    "fuzz.token_sort_ratio(\"fuzzy was a bear\", \"fuzzy fuzzy was a bear\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "bea1be96-f3c8-42c0-a16e-60b31a70db26",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "100"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fuzz.token_set_ratio(\"fuzzy was a bear\", \"fuzzy fuzzy was a bear\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "252af147-0dfb-450b-adeb-8df271c0e690",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "84"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 部分标记排序比率\n",
    "fuzz.token_sort_ratio(\"fuzzy was a bear\", \"wuzzy fuzzy was a bear\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "b6b2fbd8-b15c-4f15-abd8-bef73834d543",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "100"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    " fuzz.partial_token_sort_ratio(\"fuzzy was a bear\", \"wuzzy fuzzy was a bear\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "2808cb43-64ac-469d-b18b-a0e353cbde39",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "92.85714285714286"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from rapidfuzz import fuzz\n",
    "fuzz.partial_ratio(\"this is test!! a\", \"this is a test!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3283fa3c-80a1-4eb3-80a8-453523dd8101",
   "metadata": {},
   "outputs": [],
   "source": [
    " def new_func():\n",
    "    # 此处使用幂函数构造惩罚函数，power越大，最终结果越逼近1，power越小，最终结果越小；刊名字段权重为1，第一作者权重为1，首页-尾页权重为1\n",
    "    power = titleSimilar + mediaSimilar + authorSimilar + pageSimilar\n",
    "    \n",
    "    # 定义各个指标的权重\n",
    "    titleWeight = 0.4\n",
    "    mediaWeight = 0.3\n",
    "    authorWeight = 0.2\n",
    "    pageWeight = 0.1\n",
    "    \n",
    "    # 使用加权平均的方法计算初始 power 值\n",
    "    power = (\n",
    "            titleWeight * titleSimilar +\n",
    "            mediaWeight * mediaSimilar +\n",
    "            authorWeight * authorSimilar +\n",
    "            pageWeight * pageSimilar\n",
    "    )\n",
    "    \n",
    "    # 避免 power 过小，设置最小阈值\n",
    "    min_power = 0.1\n",
    "    \n",
    "    if isCh and mediaSimilar + authorSimilar + pageSimilar == 0:\n",
    "        power = max(power / 2, min_power)  # 平滑调整，避免过小\n",
    "    \n",
    "    if isContains(referText, dd.pub_year):\n",
    "        power = power + 1\n",
    "    else:\n",
    "        power = max(power / math.e, min_power)  # 平滑调整，避免过\n",
    "    return math.pow(similar, 1 / power)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a6a8e7a5-3488-467d-9f80-64feea156a03",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[{\"keyid\": \"00001JD16LC00ILW6FR\", \"sub_db_id\": \"00001\", \"title\": \"鼠细小病毒感染性滴度测定方法的建立及病毒制备\", \"title_alt\": \"Development of A Method for Determination of Infectious Titer of Murine Minute Virus and Preparation of The Virus\", \"author\": \"孟淑芳\", \"author_alt\": \"\", \"begin_page\": \"815\", \"journal_name_alt\": \"Chinese Journal of Biologicals\", \"journal_name\": \"中国生物制品学杂志\", \"num\": \"8\", \"pub_year\": \"2009\", \"doi\": \"10.13200/j.cjb.2009.08.85.mengshf.020\", \"rawid\": \"\", \"journal_id\": \"97789\"}, {\"keyid\": \"00001JD16LC00ILW6HR\", \"sub_db_id\": \"00001\", \"title\": \"1例Rh缺失型D--导致新生儿溶血病临床及家系的调查分析\", \"title_alt\": \"Clinical and Family Analysis on One Case of Hemolytic Disease of Newborn Due to Rhesus D--Phenotype\", \"author\": \"伍伟健\", \"author_alt\": \"\", \"begin_page\": \"812\", \"journal_name_alt\": \"Chinese Journal of Biologicals\", \"journal_name\": \"中国生物制品学杂志\", \"num\": \"8\", \"pub_year\": \"2009\", \"doi\": \"10.13200/j.cjb.2009.08.82.wuwj.027\", \"rawid\": \"\", \"journal_id\": \"97789\"}]\n"
     ]
    }
   ],
   "source": [
    "aa = [{'keyid': '00001JD16LC00ILW6FR', 'sub_db_id': '00001', 'title': '鼠细小病毒感染性滴度测定方法的建立及病毒制备', 'title_alt': 'Development of A Method for Determination of Infectious Titer of Murine Minute Virus and Preparation of The Virus', 'author': '孟淑芳', 'author_alt': '', 'begin_page': '815', 'journal_name_alt': 'Chinese Journal of Biologicals', 'journal_name': '中国生物制品学杂志', 'num': '8', 'pub_year': '2009', 'doi': '10.13200/j.cjb.2009.08.85.mengshf.020', 'rawid': '', 'journal_id': '97789'}, {'keyid': '00001JD16LC00ILW6HR', 'sub_db_id': '00001', 'title': '1例Rh缺失型D--导致新生儿溶血病临床及家系的调查分析', 'title_alt': 'Clinical and Family Analysis on One Case of Hemolytic Disease of Newborn Due to Rhesus D--Phenotype', 'author': '伍伟健', 'author_alt': '', 'begin_page': '812', 'journal_name_alt': 'Chinese Journal of Biologicals', 'journal_name': '中国生物制品学杂志', 'num': '8', 'pub_year': '2009', 'doi': '10.13200/j.cjb.2009.08.82.wuwj.027', 'rawid': '', 'journal_id': '97789'}]\n",
    "\n",
    "import json\n",
    "bb = json.dumps(aa,ensure_ascii=False)\n",
    "print(bb)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "c5c24c25-947a-43d4-b4bd-ecd9938f44cf",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "26387\n",
      "40558\n"
     ]
    }
   ],
   "source": [
    "path1 = r\"C:\\Users\\Administrator\\Documents\\WXWork\\1688853051339318\\Cache\\File\\2024-10\\cnki\"\n",
    "path2 = r\"C:\\Users\\Administrator\\Documents\\WXWork\\1688853051339318\\Cache\\File\\2024-10\\wanfang\"\n",
    "with open(path1,\"r\",encoding=\"utf-8\") as f:\n",
    "    lists = [line.strip() for line in f.readlines()]\n",
    "with open(path2,\"r\",encoding=\"utf-8\") as f:\n",
    "    list2 = [line.strip() for line in f.readlines()]\n",
    "\n",
    "print(len(lists))\n",
    "print(len(list2))\n",
    "# cartesian_product = list(itertools.product(list1, list2))\n",
    "\n",
    "# for item in cartesian_product:\n",
    "#     str1,str2 = item\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "4b2097ca-adcf-4fbc-8c32-efa9c60ab950",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.874"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "0.92*0.95"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c6a12c4f-7c14-4740-88b3-7a8b39c7ffae",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
